package com.runoob.stream;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class Test1 {

    public static void main(String[] args) {
        User u1=new User("c1","123","18");
        User u2=new User("c2","124","19");
        User u3=new User("c3","125","20");

        List<User> list=new ArrayList<>();
        list.add(u1);
        list.add(u2);
        list.add(u3);


        List<String> subList = Arrays.asList("123", "124");
        list=list.stream().filter(s->subList.contains(s.getPassword())).filter(s->s.getAge().equals("18")).collect(Collectors.toList());
        System.out.println("list = " + list);

    }
}
